package config

var (
	ServerGlobalConfig *GlobalConfig = &GlobalConfig{}
)

type GlobalConfig struct {
	ServerConfig    ServerConfig    `mapstructure:"server"`
	LoggerConfig    LoggerConfig    `mapstructure:"logger"`
	DBConfig        DBConfig        `mapstructure:"db"`
	AliyunSmsConfig AliyunSmsConfig `mapstructure:"aliyun_sms"`
	JwtConfig       JwtConfig       `mapstructure:"jwt"`
}

type ServerConfig struct {
	Port    int    `mapstructure:"port"`
	Salt    string `mapstructure:"salt"`
	Router  string `mapstructure:"router"`
	Crontab int    `mapstructure:"crontab"`
}

type LoggerConfig struct {
	FilePath   string `mapstructure:"file_path"`
	FileName   string `mapstructure:"file_name"`
	MaxSize    int    `mapstructure:"max_size"`
	MaxAge     int    `mapstructure:"max_age"`
	MaxBackups int    `mapstructure:"max_backups"`
}

type DBConfig struct {
	Uri      string `mapstructure:"uri"`
	Username string `mapstructure:"username"`
	Pwd      string `mapstructure:"pwd"`
	DBName   string `mapstructure:"dbname"`
}

type AliyunSmsConfig struct {
	AccessKeyId      string `mapstructure:"access_key_id"`
	AccessKeySecret  string `mapstructure:"access_key_secret"`
	SmsSignName      string `mapstructure:"sms_sign_name"`
	TemplateCode     string `mapstructure:"template_code"`
	TemplateParamKey string `mapstructure:"template_param_key"`
}

type JwtConfig struct {
	JwtSecret string   `mapstructure:"jwt_secret"`
	JwtExcuse []string `mapstructure:"jwt_excuse"`
}
